from rest_framework import status
from rest_framework.response import Response as RestResponse

import logging

import tsl_backend.frontend_api.models.route as routes
import tsl_backend.frontend_api.models.order_routing as order_routing
import tsl_backend.frontend_api.models.workorder as workorders

def response(code: int, message: str, data: object = None, extra: str = None) -> RestResponse:
    content = {
        "status": True if status.is_success(code) else False,
        "code": code,
        "message": message,
        "data": data
        # "extra": extra
    }

    return RestResponse(
        content,
        status=code
    )



